package com.itheima.chapter08.set.map.hashmap;
//HashMap集合存储ArrayList元素并遍历

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;

public class Hashmapdemo4 {
    public static void main(String[] args) {
        HashMap<String, ArrayList<String>> hm =new HashMap<>();
        ArrayList<String> arr1 =new ArrayList<>();
        arr1.add("zhangsan");
        arr1.add("lisi");
        arr1.add("wangwu");
        ArrayList<String> arr2 =new ArrayList<>();
        arr2.add("yuji");
        arr2.add("nhhx");
        arr2.add("baxh");
        ArrayList<String> arr3 =new ArrayList<>();
        arr3.add("zakjx");
        arr3.add("zax");
        arr3.add("xhudk");
        hm.put("一队",arr1);
        hm.put("二队",arr2);
        hm.put("三队",arr3);
        Set<String> keySet = hm.keySet();
        for (String key : keySet) {
            ArrayList<String> list = hm.get(key);
            System.out.print(key+":");
            for (String values : list) {
                System.out.print(values+"\t");
            }
            System.out.println();
        }
    }
}
